<template>
  <div>
    <breadcrumb class="breadcrumb-container"></breadcrumb>
    <div class="fz12 tip"><span>日期：{{ time }}</span> <span>代理商名称：{{ name }}</span></div>
    <table class="table mt-10">
      <thead>
        <tr>
          <th v-for="item in thead" :key="item.key" :colspan="item.colspan">{{ item.name }}</th>
        </tr>
      </thead>
      <tbody>
        <tr v-for="(item,index) in tbody" :key="index">
          <td v-for="(col,index) in item.children" :key="index" :colspan="col.colspan" :rowspan="col.rowspan">{{ col.value }}</td>
        </tr>
      </tbody>
    </table>
  </div>
</template>
<script>
import Breadcrumb from '@/components/Breadcrumb'
import { bkgeDetail } from '@/api/commission'
export default {
  data() {
    return {
      time: '',
      name: '',
      thead: [
        { name: '通道名称', key: 'channelName' },
        { name: '通道类型', key: 'channelType', colspan: 3 },
        { name: '通道佣金', key: 'channelMoney' },
        { name: '累计交易佣金', key: 'channelAllMoney' },
        { name: '累计交易笔数', key: 'channelAllNum' }
      ],
      tbody: []
    }
  },
  components: {
    Breadcrumb
  },
  created() {
    this.$nextTick(() => {
      this.time = this.$route.query.time
      this.name = this.$route.query.name
    })
    bkgeDetail(this.$route.query.id, this.$route.query.time).then(res => {
      if (res.data.errorCode === 0) {
        this.tbody = res.data.result
      } else {
        this.$message.error(res.data.errorMsg)
      }
    })
  }
}
</script>
